//
//  TestPostViewController.swift
//  DollarBuy
//
//  Created by 郑东喜 on 2016/11/10.
//  Copyright © 2016年 郑东喜. All rights reserved.
//

import UIKit

class TestPostViewController: UIViewController {
    @IBAction func TTTT(_ sender: Any) {
        if localSave.object(forKey: userToken) as? String != nil {
            let token = localSave.object(forKey: userToken) as! String
            let session = URLSession.shared
            
            
            let Url = URL.init(string: addressUrl)
            
            let request = NSMutableURLRequest.init(url: Url!)
            
            
            request.httpMethod = "POST"
            
            request.httpBody = "token=\("1233")&ac=zdx&ty=0".data(using: String.Encoding.utf8)
            
            let dataTask = session.dataTask(with: request as URLRequest) { (data, response, error) -> Void in
                if (error != nil) {
                    return
                }
                else {
                    //此处是具体的解析，具体请移步下面
                    let json: Any = try! JSONSerialization.jsonObject(with: data!, options: [])
                    
                    print(json)
                }
            }
            
            dataTask.resume()
        } else {
            print("token不存在")
            return
        }

    }

    override func viewDidLoad() {
        super.viewDidLoad()

        // Do any additional setup after loading the view.
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    


}
